﻿package mortal.game.scene3D.map3D.sceneInfo
{
    import Message.DB.Tables.*;
    import mortal.game.resource.tableConfig.*;
    import mortal.game.rules.*;

    public class BossRefreshInfo extends Object
    {
        private var _mapId:int;
        private var _x:int;
        private var _y:int;
        private var _plan:int;
        private var _bosses:Array;
        private var _bossRefreshs:Array;
        private var _isDead:Boolean;
        private var _subPoints:String;
        private var _actBosses:Array;

        public function BossRefreshInfo()
        {
            this._bosses = [];
            this._bossRefreshs = [];
            this._actBosses = [];
            return;
        }// end function

        public function get subPoints() : String
        {
            return this._subPoints;
        }// end function

        public function set subPoints(param1:String) : void
        {
            this._subPoints = param1;
            return;
        }// end function

        public function get mapId() : int
        {
            return this._mapId;
        }// end function

        public function get x() : int
        {
            return this._x;
        }// end function

        public function get y() : int
        {
            return this._y;
        }// end function

        public function get plan() : int
        {
            return this._plan;
        }// end function

        public function get bosses() : Array
        {
            return this._bosses;
        }// end function

        public function get bossRefreshs() : Array
        {
            return this._bossRefreshs;
        }// end function

        public function addActBoss(param1:TBoss) : void
        {
            this._actBosses.push(param1);
            return;
        }// end function

        public function removeActBoss(param1:TBoss) : void
        {
            var _loc_2:int = 0;
            if (this._actBosses.length != 0)
            {
                _loc_2 = this._actBosses.indexOf(param1);
                if (_loc_2 != -1)
                {
                    this._actBosses.splice(_loc_2, 1);
                }
            }
            return;
        }// end function

        public function get actBosses() : Array
        {
            return this._actBosses;
        }// end function

        public function clearActBoss() : void
        {
            if (this._actBosses.length != 0)
            {
                this._actBosses.splice(0);
            }
            return;
        }// end function

        public function updateData(param1:int, param2:int, param3:int, param4:int, param5:String) : void
        {
            var _loc_6:int = 0;
            var _loc_8:TBossRefresh = null;
            var _loc_9:TBoss = null;
            this._bossRefreshs.splice(0);
            this._bosses.splice(0);
            this._mapId = param1;
            this._x = param2;
            this._y = param3;
            this._plan = param4;
            this._subPoints = param5;
            this._bossRefreshs = BossConfig.instance.getRefreshByMapAndPlan(this._mapId, this._plan);
            var _loc_7:* = this._bossRefreshs.length;
            while (_loc_6 < _loc_7)
            {
                
                _loc_8 = this._bossRefreshs[_loc_6];
                _loc_9 = BossConfig.instance.getInfoByCode(_loc_8.bossCode);
                this._bosses.push(_loc_9);
                _loc_6++;
            }
            return;
        }// end function

        public function hasBossCode(param1:int) : Boolean
        {
            var _loc_2:TBoss = null;
            for each (_loc_2 in this._bosses)
            {
                
                if (_loc_2.code == param1)
                {
                    return true;
                }
            }
            return false;
        }// end function

        public function getNormalBoss() : TBoss
        {
            var _loc_1:TBoss = null;
            if (this._actBosses.length != 0)
            {
                for each (_loc_1 in this._actBosses)
                {
                    
                    if (!BossRule.isBossBoss(_loc_1.category))
                    {
                        return _loc_1;
                    }
                }
            }
            return null;
        }// end function

        public function set isDead(param1:Boolean) : void
        {
            this._isDead = param1;
            return;
        }// end function

        public function get isDead() : Boolean
        {
            return this._isDead;
        }// end function

        public function hasBossBoss() : Boolean
        {
            var _loc_1:TBoss = null;
            for each (_loc_1 in this._bosses)
            {
                
                if (BossRule.isBossBoss(_loc_1.type))
                {
                    return true;
                }
            }
            return false;
        }// end function

    }
}
